<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>书籍列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" th:href="@{/css/font.css}">
    <link rel="stylesheet" th:href="@{/css/xadmin.css}">
    <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>自习室</th>
                            <th>座位编号</th>
                            <th>学生姓名</th>
                            <th>学生电话</th>
                            <th>预定日期</th>
                            <th>预定时间</th>
                            <th style="text-align: center">操作</th>
                        </tr>
                        </thead>
                        <tbody>

                        <tr th:each="item,bookStat:${list}">
                            <td style="text-align: center" th:text="${bookStat.count}"></td>
                            <td style="text-align: center" th:text="${item.classnoomName}"></td>
                            <td style="text-align: center" th:text="${item.seatNo}"></td>
                            <td style="text-align: center" th:text="${item.name}"></td>
                            <td style="text-align: center" th:text="${item.phone}"></td>
                            <td style="text-align: center" th:text="${item.date}"></td>
                            <td style="text-align: center" th:text="${item.startTime + ':00-' + item.endTime + ':00'}"></td>
                            <td class="td-manage" style="text-align: center">
                                <a title="强制退订"
                                   th:onclick="del(this, [[${item.id}]])"
                                   class="layui-btn"
                                   href="javascript:;">
                                    <i class="layui-icon"></i>强制退订
                                </a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    /*用户-归还*/
    function del(obj, id) {
        layer.confirm('确认要退订吗？', function (index) {
            //发异步删除数据
            $.ajax({
                url: "/seat/deleteSeatOrder",
                type: "POST",
                data: {"id": id},
                dataType: 'json',
                success: function (result) {
                    if (result.code === 200) {
                        layer.msg("退订成功", {icon: 1, time: 1000}, function () {
                            //关闭当前页面
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            //刷新父级页面
                            window.parent.location.reload();
                            return false;
                        });
                    } else {
                        layer.msg("退订失败:" + result.msg);
                    }
                },
            });

        });
    }
</script>
</html>
